package com.example.sihookuiklydemo.theme

import com.example.sihookuiklydemo.theme.ThemeColors.Companion.KEY_BACKGROUND
import com.tencent.kuikly.core.base.Color
import com.tencent.kuikly.core.nvi.serialization.json.JSONObject

data class ThemeColors(
    // 主题色
    val primary: Color,
    val background: Color,
    val mainTextColor: Color,
    var grey_1:Color,
    var grey_1a: Color,
    var bg_2: Color,
    var grey_2:Color,
    var bg_2a:Color,

    var toastBackground:Color=Color(0Xcc000000)

) {
    companion object {
        // 定义所有键名常量
        private const val KEY_PRIMARY = "primary"
        private const val KEY_BACKGROUND = "background"
        private const val KEY_BACKGROUND_ELEMENT = "backgroundElement"
        private const val KEY_TOP_BAR_BACKGROUND = "topBarBackground"
        private const val KEY_TOP_BAR_TEXT_UNFOCUSED = "topBarTextUnfocused"
        private const val KEY_TOP_BAR_TEXT_FOCUSED = "topBarTextFocused"
        private const val KEY_TOP_BAR_INDICATOR = "topBarIndicator"
        private const val KEY_TOP_BAR_NESTED_BACKGROUND = "topBarNestedBackground"
        private const val KEY_TOP_BAR_NESTED_TEXT_UNFOCUSED = "topBarNestedTextUnfocused"
        private const val KEY_TOP_BAR_NESTED_TEXT_FOCUSED = "topBarNestedTextFocused"
        private const val KEY_TAB_BAR_BACKGROUND = "tabBarBackground"
        private const val KEY_TAB_BAR_TEXT_UNFOCUSED = "tabBarTextUnfocused"
        private const val KEY_TAB_BAR_TEXT_FOCUSED = "tabBarTextFocused"
        private const val KEY_TAB_BAR_ICON_UNFOCUSED = "tabBarIconUnfocused"
        private const val KEY_TAB_BAR_ICON_FOCUSED = "tabBarIconFocused"
        private const val KEY_FEED_BACKGROUND = "feedBackground"
        private const val KEY_FEED_USER_NAME_NORMAL = "feedUserName"
        private const val KEY_FEED_USER_NAME_MEMBER = "feedUserNameMembership"
        private const val KEY_FEED_USER_SIGNATURE = "feedUserPostTime"
        private const val KEY_FEED_USER_DEVICE = "feedUserDevice"
        private const val KEY_FEED_USER_FOLLOW_BUTTON = "feedUserFollowButton"
        private const val KEY_FEED_CONTENT_TEXT = "feedContentText"
        private const val KEY_FEED_CONTENT_QUOTE_TEXT = "feedContentQuoteText"
        private const val KEY_FEED_CONTENT_QUOTE_BACKGROUND = "feedContentQuoteBackground"
        private const val KEY_FEED_CONTENT_DIVIDER = "feedContentDivider"
        private const val KEY_FEED_BOTTOM_TEXT = "feedBottomText"
        private const val KEY_FEED_BOTTOM_ICON = "feedBottomIcon"

        fun fromJson(json: JSONObject): ThemeColors {
            return ThemeColors(
                primary = Color(json.optString(KEY_PRIMARY)),
                background = Color(json.optString(KEY_BACKGROUND)),
                mainTextColor = Color(json.optString(KEY_BACKGROUND)),
                grey_1 = Color(json.optString(KEY_BACKGROUND)),
                grey_1a = Color(0x4de0e2e7),
                bg_2 = Color(0x4de0e2e7),
                grey_2 = Color(0x4de0e2e7),
                bg_2a = Color(0x99ffffff)
            )
        }
    }
}

val lightColorScheme = ThemeColors(
    primary = Color.WHITE,
    background = Color.WHITE,
    mainTextColor = Color(0xff454E56),
    grey_1a = Color(0x4de0e2e7),
    grey_1 = Color(0xffE0E2E7),
    bg_2 = Color.WHITE,
    grey_2 = Color(0xffEFEFEF),
    bg_2a = Color(0x99ffffff)
)

val darkColorScheme = ThemeColors(
    primary = Color(0xff2c2c2c),
    background = Color(0xff2c2c2c),
    mainTextColor = Color.WHITE,
    grey_1a = Color(0x4d4d4d4d),
    grey_1 = Color(0xff676362),
    bg_2 = Color(0xff2c2c2c),
    grey_2 = Color(0xff515151),
    bg_2a = Color(0x993e3e3e)
)

val blueColorScheme = ThemeColors(
    primary = Color(0xFF415F91),
    background = Color(0xFFF3F3FA),
    mainTextColor = Color.WHITE,
    grey_1a = Color(0x4de0e2e7),
    grey_1 = Color(0x4de0e2e7),
    bg_2 = Color(0xff2c2c2c),
    grey_2 = Color.WHITE,
    bg_2a = Color(0x993e3e3e)
)
